#ifndef CARDIF_H
#define CARDIF_H

#ifdef WIN32
#include <pcap.h>
#else
#include <netpacket/packet.h>
#endif

#ifndef ETH_P_EAPOL
#define ETH_P_EAPOL 0x888e
#endif

typedef struct cardif_struct
{
  char ifName[256];
  // A pointer to some data that the OS specific frame handler will
  // use.  (Such as a socket.)
#ifdef WIN32
  pcap_t *fp;  
#else
  int sock;
  struct sockaddr_ll sll;
#endif

  unsigned char localMAC[6];       // Source MAC address.
  unsigned int ip, netmask, netaddr, netgate, dns;
}cardif_t;

int cardif_initialize(cardif_t *this, char *ifName);
int	cardif_sendframe(cardif_t *this, char *sendframe, int send_size);
int	cardif_recvframe(cardif_t *this, char *recvframe, int recv_size);
void cardif_getLocalMAC(cardif_t *this, char localMAC[6]);
//int cardif_getfd(cardif_t *this);
void cardif_delete(cardif_t *this);

unsigned int getustime();
char * mac_pton(const char *s);
const char *  mac_ntop(char mac[6]);
unsigned int ip_pton(char *s);
char * ip_ntop(unsigned int ip);

#endif
